import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '费用类型编码',
    align: "center",
    dataIndex: 'code'
  },
  {
    title: '费用类型名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '开票代码',
    align: "center",
    dataIndex: 'billCode'
  },
  {
    title: '开票名称',
    align: "center",
    dataIndex: 'billName'
  },
  {
    title: '税率',
    align: "center",
    dataIndex: 'taxRate'
  },
  {
    title: '是否含税',
    dataIndex: 'taxBoolean',
    width: 160,
    customRender: ({ text }) => {
      return text == '0' ? '不含税' : text == '1' ? '含税' : '';
    },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '费用类型编码',
    field: 'code',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入费用类型编码!' },
      ];
    },
  },
  {
    label: '费用类型名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入费用类型名称!' },
      ];
    },
  },
  {
    label: '开票代码',
    field: 'billCode',
    component: 'Input',
  },
  {
    label: '开票名称',
    field: 'billName',
    component: 'Input',
  },
  {
    label: '税率',
    field: 'taxRate',
    component: 'Input',
  },
  {
    label: '是否含税',
    field: 'taxBoolean',
    component: 'RadioButtonGroup',
    componentProps: {
      options: [
        { label: '不含税', value: 0 },
        { label: '含税', value: 0 },
      ],
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  code: { title: '费用类型编码', order: 0, view: 'text', type: 'string', },
  name: { title: '费用类型名称', order: 1, view: 'text', type: 'string', },
  createTime: { title: '创建时间', order: 2, view: 'datetime', type: 'string', },
  updateTime: { title: '更新时间', order: 3, view: 'datetime', type: 'string', },
  createBy: { title: '创建人', order: 4, view: 'text', type: 'string', },
  updateBy: { title: '更新人', order: 5, view: 'text', type: 'string', },
  billCode: { title: '开票代码', order: 6, view: 'text', type: 'string', },
  billName: { title: '开票名称', order: 7, view: 'text', type: 'string', },
};
